package org.loadsavant.task;

import java.util.Set;

/**
 * A task loader is responsible for locating task candidates,
 * determining which are valid and instantiating task definitions
 * for valid tasks.  Implementations of this interface define the 
 * task candidate space, which could be a classloader or virtual
 * storage and delegate to a {@link TaskDefinitionParser} for
 * validation and task definition.
 * 
 * @author Matt Betzel mattbetzel@gmail.com
 */
public interface TaskLoader {
	/**
	 * Returns an immutable set of task definitions loaded
	 * from the task candidate space.
	 * @return immutable set of {@link TaskDefinition}
	 */
	Set<TaskDefinition> getTaskDefinitions();
	
	/**
	 * Return a single {@link TaskDefinition} with the specified
	 * name.  If multiple tasks have the same name then only one
	 * is returned.
	 * @param name name of the task to return
	 * @return {@link TaskDefinition} with the specified name or null if 
	 * one doesn't exist
	 */
	TaskDefinition getTaskDefinition(String name);
}
